package graphique;

import javax.media.opengl.GL;
import javax.media.opengl.glu.GLU;
import javax.media.opengl.glu.GLUquadric;

public class Particule
{
	static int maxPartFeu = 15;
	static int maxPartFumee = 15;
	static int maxPartVapeur = 15;
	static GLU glu=new GLU();
	
	public static void feu(GL gl)
	{
		GLUquadric quadric=glu.gluNewQuadric();
		
		for( int i = 0 ; i < maxPartFeu ; i++ )
		{
			gl.glPushMatrix();
			gl.glTranslated( Math.random() * 0.01 , Math.random() * 0.01 , Math.random() * 0.05);
			gl.glColor4d(1f, Math.random() , 0f, 0.7f);
			quadric=glu.gluNewQuadric();
			glu.gluQuadricNormals(quadric, GL.GL_TRUE);
			glu.gluSphere(quadric, 0.003 , 32, 16);
			gl.glPopMatrix();
		}
	}
	
	public static void fumee(GL gl)
	{
		GLUquadric quadric=glu.gluNewQuadric();
		
		for( int i = 0 ; i < maxPartFumee ; i++ )
		{
			gl.glPushMatrix();
			double couleur = Math.random()/2;
			gl.glTranslated( Math.random() * 0.03 , Math.random() * 0.03 , Math.random() * 0.09);
			gl.glColor4d( couleur , couleur , couleur , 0.8f);
			quadric=glu.gluNewQuadric();
			glu.gluQuadricNormals(quadric, GL.GL_TRUE);
			glu.gluSphere(quadric, Math.random() * 0.009 , 32, 16);
			gl.glPopMatrix();
		}
	}

	public static void vapeur(GL gl)
	{
		GLUquadric quadric=glu.gluNewQuadric();
		
		for( int i = 0 ; i < maxPartVapeur ; i++ )
		{
			gl.glPushMatrix();
			double couleur = 0.75 + Math.random()/4;
			gl.glTranslated( Math.random() * 0.03 , Math.random() * 0.03 , Math.random() * 0.15 );
			gl.glColor4d( couleur , couleur , couleur , 0.7f);
			quadric=glu.gluNewQuadric();
			glu.gluQuadricNormals(quadric, GL.GL_TRUE);
			glu.gluSphere(quadric, Math.random() * 0.003 , 32, 16);
			gl.glPopMatrix();
		}
	}
}
